﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAO;
using BUL;
using System.Data;
namespace Hospital
{
    public partial class ManagerWard : System.Web.UI.Page
    {
        WardBUL ward = new WardBUL();
        DivisionBUL div = new DivisionBUL();
        DataTable dt;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) {
                loadWard();
            }
        }
        public void loadWard() {
            dt = ward.load();
            listWard.DataSource = dt;
            listWard.DataTextField = "name";
            listWard.DataValueField = "idWard";
            listWard.DataBind();
            dt.Clear();
        }
        public void load() { 
          //  div.load1
        }
        protected void btnInsert_Click(object sender, EventArgs e)
        {
           
        }

        protected void btnDelete_Click(object sender, EventArgs e)
        {

        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {

        }

        protected void txtReset_Click(object sender, EventArgs e)
        {

        }

        protected void listWard_SelectedIndexChanged(object sender, EventArgs e)
        {
            dt = div.load1(listWard.SelectedValue.ToString());
            if (dt.Rows.Count != 0)
            {
                txtNumber.Text = dt.Rows[0][0].ToString();
                txtNurse.Text = dt.Rows[0][1].ToString();
                txtPhone.Text = dt.Rows[0][2].ToString();
            }
            dt.Clear();
        }
    }
}